package zy;
import java.awt.GridLayout;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Random;

import javax.swing.*;

import com.jsu.dao.LinkJDBC;
public class Demo {
	public static void main(String[] arg) throws SQLException {
		String titles[]= {"time","money","kind","others","username"};
		
		int year[]= {2000,2001};
		int month[]= {1,2,3,4,5,6,7,8,9,10,11,12};
		int day[]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28};
		String data[]=new String[11000];
		int n=0;
		for(int i=0;i<2;i++) {
			for(int j=0;j<12;j++) {
				for(int k=0;k<28;k++) {
					data[n++]=year[i]+"年"+month[j]+"月"+day[k]+"日";
				}
			}
		}
//		System.out.println(n);
		
//		float money=((int)(new Random().nextFloat()*10000))/100;
//		System.out.println(money);
//		System.out.println(String.valueOf(money));
		
//		String kind[]= {"工资","取款","提成","补贴","奖金"};
		String kind[]= {"就医","学费","购物","丢失","水电费"};
		
		String username[]= {"张三","李四","王五","赵六"};
		
		Connection conn=new LinkJDBC().getConnection();
		String sql="insert into outcome(time,money,kind,username) values(?,?,?,?)";
		PreparedStatement pstmt=conn.prepareStatement(sql);
		for(int i=0;i<n;i++) {
			for(int j=0;j<5;j++) {
				for(int k=0;k<4;k++) {
					pstmt.setString(1, data[i]);
					pstmt.setString(2, String.valueOf(((int)(new Random().nextFloat()*10000))/100));//money
					pstmt.setString(3, kind[j]);
					pstmt.setString(4, username[k]);
					pstmt.executeUpdate();
				}
			}
		}
		
	}
}